/*
	Travis Tarr
	CS362-400
	
	Assignment #3
	
	Testing the isGameOver() function
	int isGameOver(struct gameState *state)
	
*/

#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "rngs.h"

void testIsGameOver() {
    int i;
    int seed = 1000;
    int numPlayer = 2;
    int maxBonus = 10;
    int p, r, handCount;
    int bonus;
    int k[10] = {adventurer, council_room, feast, gardens, mine
               , remodel, smithy, village, baron, great_hall};
    struct gameState G;
    int maxHandCount = 5;


    printf ("TESTING isGameOver():\n");

	memset(&G, 23, sizeof(struct gameState));   // clear the game state
	r = initializeGame(numPlayer, k, seed, &G); // initialize a new game
	
	
	// assert game-over when province supply is 0
	G.supplyCount[province] = 0;
	if(isGameOver(&G) == 1) {
		printf("isGameOver(): PASSED when province supply is 0\n");
	} else {
		printf("isGameOver(): FAILED when province supply is 0\n");
	}
	
	// gameOver should return false
	for(i = 0; i < 3; i++) {
	
		G.supplyCount[i] = 0;
		if(isGameOver(&G) == 0) {
			printf("isGameOver(): PASSED when %d supply piles are 0\n", i);
		} else {
			printf("isGameOver(): FAILED when %d supply piles are 0\n", i);
		}
	}
	// gameOver should return true
	for(i = 3; i < 10; i++) {
	
		G.supplyCount[i] = 0;
		if(isGameOver(&G) == 1) {
			printf("isGameOver(): PASSED when %d supply piles are 0\n", i);
		} else {
			printf("isGameOver(): FAILED when %d supply piles are 0\n", i);
		}
	}

	
}

int main() {
	testIsGameOver();
	return 0;
}